package org.zachary.prosocialbehaviorservice.application.event_listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener;
import org.zachary.prosocialbehaviorservice.domain.aggregate_model.activity_user.event.ExitActivityEvent;
import org.zachary.prosocialbehaviorservice.domain.aggregate_model.activity_user.event.FinishedItemEvent;
import org.zachary.prosocialbehaviorservice.domain.aggregate_model.activity_user.event.JoinActivityEvent;

@Slf4j
@Component
public class UserActivityEventListener {
    @TransactionalEventListener
    public void onUserJoinActivity(JoinActivityEvent event) {
        log.info("用户参与活动成功，详情为{}",event.getSource());
    }

    @TransactionalEventListener
    public void onUserExitActivity(ExitActivityEvent event) {
        log.info("用户退出活动成功，详情为{}",event.getSource());
    }
    @TransactionalEventListener
    public void onUserExitActivity(FinishedItemEvent event) {
        log.info("用户已完成该活动，加分已完成，详情为{}",event.getSource());
    }
}
